<?php

namespace App\Admin\Controllers;

use Encore\Admin\Grid;
use App\Models\GoldSplit;
use Encore\Admin\Controllers\AdminController;

class GoldSplitsController extends AdminController
{
    protected $title = '金店拆单';

    protected function grid()
    {
        $grid = new Grid(new GoldSplit());
        $grid->model()->orderByDesc('id');

        $grid->column('id', 'ID');
        $grid->column('user_id', '会员')->display(function () {
            return $this->user->nameText(true);
        });
        $grid->column('new_gold_product_id', '新商品');
        $grid->column('split_record_id', '拆分自');
        $grid->column('settled_record_id', '结算至');
        $grid->column('round', '轮次');
        $grid->column('gold_seed_title', '种子');
        $grid->column('product_title', '商品');
        $grid->column('split_price', __('Split price'));
        $grid->column('split_profit', __('Split profit'));
        $grid->column('split_beans', __('Split beans'));
        $grid->column('settled_at', __('Settled at'));
        $grid->column('created_at', __('Created at'));

        $grid->disableRowSelector();
        $grid->disableCreateButton();
        $grid->disableExport();
        $grid->disableActions();

        return $grid;
    }
}
